Micron Document
Livres et Wikis | Archives | Info


Linux from Scratch
layout: Wide Β· Narrow Β· Centered
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
Linux From Scratch (LFS) is a type of a Linux installation and the name of a book written by Gerard Beekmans, and as of May 2021, mainly maintained by Bruce Dubbs. The book gives readers instructions on how to build a Linux system from source. The book is available freely from the Linux From Scratch site.cite-ref-4[4]

Contents

β€’ Reception
β€’ See also
β€’ References

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Projects under LFS

Linux From Scratch is a way to install a working Linux system by building all components of it manually. This is, naturally, a longer process than installing a pre-compiled Linux distribution. According to the Linux From Scratch site, the advantages to this method are a compact, flexible and secure system and a greater understanding of the internal workings of the Linux-based operating systems.cite-ref-5[5]

To keep LFS small and focused, the book Beyond Linux From Scratch (BLFS) was created, which presents instructions on how to further develop the basic Linux system that was created in LFS. It introduces and guides the reader through additions to the system including the X Window System, desktop environments (KDE, GNOME, Xfce, LXDE), productivity software, web browsers, programming languages and tools, multimedia software, and network management and system administration tools. Since Release 5.0, the BLFS book version matches the LFS book version.cite-ref-6[6]

The book Cross Linux From Scratch (CLFS) focuses on cross compiling, including compiling for headless or embedded systems that can run Linux, but lack the resources needed to compile Linux. CLFS supports a broad range of processors and addresses advanced techniques not included in the LFS book such as cross-build toolchains, multilibrary support (32 & 64-bit libraries side-by-side), and alternative instruction set architectures such as Itanium, SPARC, MIPS, and Alpha.

The Linux from Scratch project, like BitBake, also supports cross-compiling Linux for ARM embedded systems such as the Raspberry Pi and BeagleBone.cite-ref-7[7]cite-ref-8[8]

The book Hardened Linux From Scratch (HLFS) focuses on security enhancements such as hardened kernel patches, mandatory access control policies, stack-smashing protection, and address space layout randomization. Besides its main purpose of creating a security-focused operating system, HLFS had the secondary goal of being a security teaching tool. It has not been updated since 2011. As of 17 February 2025, the HLFS book has disappeared from the LFS web site.

Automated Linux From Scratch (ALFS) is a project designed to automate the process of creating an LFS system. It is aimed at users who have gone through the LFS and BLFS books several times and wish to reduce the amount of work involved. A secondary goal is to act as a test of the LFS and BLFS books by directly extracting and running instructions from the XML sources of the LFS and BLFS books.

Requirements and procedure

A clean partition and a working Linux system with a compiler and some essential software libraries are required to build LFS. Instead of installing from an existing Linux system, one can also use a Live CD to build an LFS system.

The project formerly maintained the Linux From Scratch Live CD.cite-ref-linuxfromscratch-org-9-0[9] LFS Live CD contains all the source packages (in the full version of the Live CD only), the LFS book, automated building tools and (except for the minimal Live CD version) an Xfce GUI environment to work in. The official LFS Live CD is no longer maintained, and cannot be used to build the LFS version7 or later.cite-ref-linuxfromscratch-org-9-1[9] There are, however, two unofficial builds that can be used to build a 32-bit or 64-bit kernel and userspace respectively for LFS 7.x.cite-ref-10[10]

First, a toolchain must be compiled consisting of the tools used to compile LFS, like GCC, glibc, binutils, and other necessary utilities. Then, the root directory must be changed, (using chroot), to the toolchain's partition to start building the final system. One of the first packages to compile is glibc; after that, the toolchain's linker must be adjusted to link against the newly built glibc, so that all other packages that will make up the finished system can be linked against it as well. During the chroot phase, bash's hashing feature is turned off and the temporary toolchain's bin directory moved to the end of PATH. This way the newly compiled programs come first in PATH and the new system builds on its own new components.

List of packages in LFS

| Component | Description |
|---|---|
| Acl | An access control list (ACL), with resp… |
| Attr | Commands for Manipulating Filesystem Ex… |
| Autoconf | Tool for producing configure scripts fo… |
| Automake | A programming tool that produces portab… |
| Bash | A free software Unix shell written for… |
| bc | bc is a basic calculator (often referre… |
| Binutils | A collection of programming tools for t… |
| Bison | A parser generator that is part of the… |
| Bzip2 | A free and open source lossless data co… |
| Check | A unit testing framework for C . |
| Coreutils | A package of GNU software containing ma… |
| DejaGNU | A framework for testing other programs.… |
| Diffutils | A data comparison utility that outputs… |
| E2fsprogs | e2fsprogs (sometimes called the e2fs pr… |
| Elfutils | A collection of utilities and libraries… |
| Eudev | A fork of udev in order to avoid depend… |
| Expat | A stream -oriented XML 1.0 parser libra… |
| Expect | Expect is a Unix automation and testing… |
| File | file command is a standard Unix program… |
| Findutils | The GNU Find Utilities are the basic di… |
| Flex | flex (fast lexical analyzer generator)… |
| Gawk | Gawk is a programming language that is… |
| GCC | The GNU Compiler Collection (usually sh… |
| GDBM | GDBM simple database engines |
| Gettext | Gettext is the GNU internationalization… |
| Glibc | The GNU C Library, commonly known as gl… |
| GMP | The GNU Multiple-Precision Library, als… |
| Gperf | A perfect hash function generator. For… |
| Grep | grep is a command line text search util… |
| Groff | Groff is the GNU replacement for the tr… |
| GRUB | GNU GRUB (short for GNU GRand Unified B… |
| Gzip | Gzip is a software application used for… |
| iana-etc. | iana-etc. installs services and protoco… |
| Inetutils | A collection of network tools, includin… |
| Intltool | A set of tools to centralize translatio… |
| IPRoute2 | A collection of userspace utilities for… |
| Kbd | A package contains tools for managing t… |
| Kmod | A multi-call binary which implements th… |
| less | less is a terminal pager program on Uni… |
| LFS-Bootscripts | The LFS-Bootscripts package contains a… |
| Libcap | An alternative to the superuser model o… |
| Libffi | A Portable Foreign Function Interface L… |
| Libpipeline | Libpipeline is a C library for manipula… |
| Libtool | GNU Libtool is a GNU programming tool f… |
| Linux | The Linux kernel is an operating system… |
| GNU m4 | GNU m4 is the GNU version of the m4 mac… |
| make | Make is a utility for automatically bui… |
| Man-DB | Man-DB is an implementation of the stan… |
| Man-pages | A man page (short for manual page) is a… |
| Meson | an open source build system meant to be… |
| MPC | A C library for the arithmetic of compl… |
| MPFR | GNU C library for multiple-precision fl… |
| ncurses | A programming library for writing text… |
| Ninja | A small build system with a focus on sp… |
| OpenSSL | A software library for applications tha… |
| Patch | A computer tool for Unix programs that… |
| Perl | A dynamic interpreted programming langu… |
| Pkg-config | A computer program that provides a unif… |
| Procps | A set of command line and full-screen u… |
| Psmisc | A set of some small useful utilities th… |
| Python | An open source interpreted high-level p… |
| Python Documentation | Package contains the Python development… |
| Readline | GNU readline is a software library crea… |
| sed | sed ( stream editor ) is a Unix utility… |
| Shadow | A tool on most Unix and Unix-like opera… |
| Sysklogd | A Kernel and system logging daemons tha… |
| Sysvinit | System V style init programs that contr… |
| tar | tar is a program that provides the abil… |
| Tcl | Tool Command Language is a dynamic scri… |
| Texinfo | A typesetting syntax used for generatin… |
| tzdata | The public-domain time zone database co… |
| Udev Configuration Tarball | The Udev package contains programs for… |
| util-linux | The Util-linux package contains miscell… |
| Vim language files (recommended) | A text editor built to create and chang… |
| Wheel | This library is the reference implement… |
| XML::Parser | |
| XZ Utils | A general-purpose data compression soft… |
| Zlib | Zlib is a software library used for dat… |
| zstd | zstd a fast lossless compression algori… |

| Component | License |
|---|---|
| Acl | GNU GPL |
| Attr | GNU GPL |
| Autoconf | GNU GPL |
| Automake | GNU GPL |
| Bash | GNU GPL |
| bc | GNU GPL |
| Binutils | GNU GPL |
| Bison | GNU GPL |
| Bzip2 | BSD-like License |
| Check | GNU GPL |
| Coreutils | GNU GPL |
| DejaGNU | GNU GPL |
| Diffutils | GNU GPL |
| E2fsprogs | GNU GPL |
| Elfutils | GNU GPL and GNU LGPL |
| Eudev | GNU GPL |
| Expat | MIT License |
| Expect | Public domain |
| File | BSD-like License |
| Findutils | GNU GPL |
| Flex | BSD license |
| Gawk | GNU GPL |
| GCC | GNU GPL |
| GDBM | GNU GPL |
| Gettext | GNU GPL |
| Glibc | GNU GPL |
| GMP | GNU GPL |
| Gperf | GNU GPL |
| Grep | GNU GPL |
| Groff | GNU GPL |
| GRUB | GNU GPL |
| Gzip | GNU GPL |
| iana-etc. | Open Software License |
| Inetutils | GNU GPL |
| Intltool | GNU GPL |
| IPRoute2 | GNU GPL |
| Kbd | GNU GPL |
| Kmod | GNU GPL |
| less | Dual: either GPL or BSD-like License |
| LFS-Bootscripts | Creative Commons licenses and MIT Licen… |
| Libffi | MIT License |
| Libpipeline | GNU GPL |
| Libtool | GNU GPL |
| Linux | GNU GPL |
| GNU m4 | GNU GPL |
| make | GNU GPL |
| Man-DB | GNU GPL |
| Man-pages | Multiple Licenses. |
| Meson | Apache License |
| MPC | GNU LGPL |
| MPFR | GNU LGPL and GNU GPL for special except… |
| ncurses | X11 License |
| Ninja | Apache License |
| OpenSSL | Apache License 1.0 and four-clause BSD… |
| Patch | GNU GPL |
| Perl | Artistic License 1.0 or GNU GPL |
| Pkg-config | GNU GPL |
| Procps | GNU GPL and GNU LGPL |
| Psmisc | GNU GPL |
| Python | Python Software Foundation License |
| Python Documentation | Python Software Foundation License |
| Readline | GNU GPL |
| sed | GNU GPL |
| Shadow | Artistic License or BSD-like License |
| Sysklogd | GNU GPL |
| Sysvinit | GNU GPL |
| tar | GNU GPL |
| Tcl | BSD-like License |
| Texinfo | GNU GPL |
| tzdata | Public domain and BSD |
| Udev Configuration Tarball | Creative Commons licenses and MIT Licen… |
| util-linux | GNU GPL |
| Vim language files (recommended) | Free software ( Vim License ), charityw… |
| Wheel | MIT |
| XZ Utils | GNU GPL and GNU LGPL |
| Zlib | zlib license |
| zstd | BSD + GPLv2 dual license. |

cite-ref-18[18] This is a list of the packages included in CLFS version 1.1.0. Unless otherwise noted, this list is applicable to all supported architectures.

Standard build unit

A "standard build unit" ("SBU") is a term used during initial bootstrapping of the system, and represents the amount of time required to build the first package in LFS on a given computer. Its creation was prompted by the long time required to build an LFS system, and the desire of many users to know how long a source tarball will take to build ahead of time.

As of Linux From Scratch version 10.1, the first package built by the user is GNU binutils. When building it, users are encouraged to measure the build process using shell constructs and dub that time the system's "standard build unit". Once this number is known, an estimate of the time required to build later packages is expressed relative to the known SBU.

Several packages built during compilation take much longer to build than binutils, including the GNU C Library (rated at 4.2 SBUs) and the GNU Compiler Collection (rated at 11 SBUs). The unit must be interpreted as an approximation; various factors influence the actual time required to build a package.

Reception

LWN.net reviewed LFS in 2004:cite-ref-19[19]

Linux From Scratch is a wonderful project. It should become a compulsory reading material for all Linux training courses, and something that every Linux enthusiast should complete at least once. This would also create another interesting side effect: people who tend to be quick in expressing dissatisfaction on the distributions' mailing lists and forums would probably show a lot more respect for the developers. Installing a ready-made distribution is a trivial task. Building up a set of 4 CDs containing a stable, secure and reliable operating system, plus thousands of applications, is most definitely not.

Tux Machines wrote a review about Linux From Scratch 6.1 in 2005:cite-ref-20[20]

Now on to BLFS. Unfortunately Beyond Linux From Scratch is always a book behind it seems. To me it's not a real install until one can log into a window manager.

Tux Machines also has a secondcite-ref-21[21] and a third partcite-ref-22[22] of the review.

See also

Other source-based Linux distributions:

β€’ Gentoo Linux
β€’ Source Mage
β€’ GoboLinux
β€’ CRUX

References

cite-note-wikidata-40424284b910831dd7f4b1268bde8c4b760fd767-v20-11. "Version 12.3". 5 March 2025. Retrieved 5 March 2025.
cite-note-22. "iii. LFS Target Architectures". linuxfromscratch.org. Retrieved 17 July 2025.
cite-note-33. "Appendix D. LFS Licenses". Retrieved 9 August 2023.
cite-note-44. ↑ "Download LFS". linuxfromscratch.org. Retrieved 11 March 2025.
cite-note-55. ↑ "What is Linux From Scratch?". Retrieved 11 March 2025.
cite-note-66. ↑ Gerard Beekmans: Beyond Linux From Scratch, Version 6.3 (August 2008)
cite-note-77. ↑ "Cross-Compiled Linux From Scratch - Embedded". Retrieved 11 March 2025..
cite-note-88. ↑ citerefhoran2013Horan, Brendan (12 June 2013). Practical Raspberry Pi. Apress. p. 105. ISBN 9781430249726.
cite-note-linuxfromscratch-org-99. ↑ "LFS LiveCD Project Homepage". www.linuxfromscratch.org. Retrieved 25 May 2018.
cite-note-1010. ↑ "Index of /~kb0iic/livecdupd". clfs.org. Retrieved 25 May 2018.
cite-note-0-114. "Licenses for manual pages". www.kernel.org. Retrieved 25 May 2018.
cite-note-1-125. "NCURSES – Licensing". Retrieved 9 July 2013.
cite-note-artistic-1-0-136. "The "Artistic License" - dev.perl.org". dev.perl.org. Retrieved 25 May 2018.
cite-note-artistic-1-0-git-147. Artistic - file on the Perl 5 git repository
cite-note-licensing-158. "Perl Licensing". dev.perl.org. Retrieved 8 January 2011.
cite-note-tool-command-language-license-169. "Tcl/Tk Licensing Terms". Retrieved 8 January 2011.
cite-note-1710. "New license", GitHub "facebook/zstd"
cite-note-1818. ↑ "LIST: /lfs/downloads/stable/wget-list" (txt).
cite-note-1919. ↑ "Learning with Linux From Scratch [LWN.net]". lwn.net. Retrieved 28 March 2020.
cite-note-2020. ↑ "Linux From Scratch 6.1 (part 1?) | Tux Machines". www.tuxmachines.org. Retrieved 28 March 2020.
cite-note-2121. ↑ "Linux From Scratch 6.1 - Part 2 - BLFS | Tux Machines". www.tuxmachines.org. Retrieved 28 March 2020.
cite-note-2222. ↑ "Beyond Beyond Linux from Scratch (lfs - part3) | Tux Machines". www.tuxmachines.org. Retrieved 28 March 2020.

β€’ "LFS Project Homepage". Linux From Scratch. Gerard Beekmans. 17 March 2008. Retrieved 17 March 2008.

External links

β€’ Official website
β€’ Linux From Scratch at DistroWatch
β€’ Interview with Gerard Beekmans
β€’ Another interview with Gerard Beekmans